package com.game.center.controller;

import com.game.center.common.ServerResponse;
import com.game.center.messages.request.*;
import com.game.center.messages.response.ActivityFishResponseVo;
import com.game.center.messages.response.ActivityInfoResponseVo;
import com.game.center.messages.response.ActivityListResponseVo;
import com.game.center.messages.response.FishPoleVo;
import com.game.center.messages.response.vo.ActivityAwardVo;
import com.game.center.messages.response.vo.ActivityRankVo;
import com.game.center.messages.response.vo.AwardVo;
import com.game.center.service.ActivityService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Tag(name = "03 活动管理", description = "活动管理 API")
@Slf4j
@RestController
@RequestMapping("/activity")
@ApiResponses(@ApiResponse(responseCode = "200", description = "接口请求成功"))
public class ActivityController {

    @Autowired
    protected ActivityService activityService;

    @Operation(summary = "get_activity_list", description = "获取钓鱼活动列表")
    @PostMapping("/get_activity_list")
    @ResponseBody
    public ServerResponse<List<ActivityListResponseVo>> getActivityList(@Validated @RequestBody ActivityListRequestParam requestParam, HttpServletRequest request) {
        List<ActivityListResponseVo> responseVoList = activityService.getActivityList(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "get_activity_info", description = "获取钓鱼活动详细信息")
    @PostMapping("/get_activity_info")
    @ResponseBody
    public ServerResponse<ActivityInfoResponseVo> getActivityInfo(@Validated @RequestBody ActivityInfoRequestParam requestParam, HttpServletRequest request) {
        ActivityInfoResponseVo responseVo = activityService.getActivityInfo(requestParam);
        return new ServerResponse<>(responseVo);
    }

    @Operation(summary = "get_activity_player_rank_info", description = "通过手机号获取鱼获排行榜")
    @PostMapping("/get_activity_player_rank_info")
    @ResponseBody
    public ServerResponse<List<ActivityRankVo>> getActivityPlayerRankInfo(@Validated @RequestBody ActivityRankRequestParam requestParam, HttpServletRequest request) {
        List<ActivityRankVo> responseVo = activityService.getActivityPlayerRankInfo(requestParam);
        return new ServerResponse<>(responseVo);
    }

    @Operation(summary = "get_activity_player_fish_list", description = "获取玩家钓鱼活动中鱼记录列表")
    @PostMapping("/get_activity_player_fish_list")
    @ResponseBody
    public ServerResponse<List<ActivityFishResponseVo>> getActivityPlayerFishList(@Validated @RequestBody ActivityFishRequestParam requestParam, HttpServletRequest request) {
        List<ActivityFishResponseVo> responseVo = activityService.getActivityPlayerFishList(requestParam);
        return new ServerResponse<>(responseVo);
    }

    @Operation(summary = "add_activity_info", description = "添加钓鱼活动信息")
    @PostMapping("/add_activity_info")
    @ResponseBody
    public ServerResponse<List<ActivityListResponseVo>> addActivityInfo(@Validated @RequestBody ActivityAddRequestParam requestParam, HttpServletRequest request) {
        List<ActivityListResponseVo> responseVoList = activityService.addActivityInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "edit_activity_info", description = "编辑钓鱼活动信息")
    @PostMapping("/edit_activity_info")
    @ResponseBody
    public ServerResponse<List<ActivityListResponseVo>> editActivityInfo(@Validated @RequestBody ActivityEditRequestParam requestParam, HttpServletRequest request) {
        List<ActivityListResponseVo> responseVoList = activityService.editActivityInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "delete_activity_info", description = "删除钓鱼活动信息")
    @PostMapping("/delete_activity_info")
    @ResponseBody
    public ServerResponse<List<ActivityListResponseVo>> deleteActivityInfo(@Validated @RequestBody ActivityDeleteRequestParam requestParam, HttpServletRequest request) {
        List<ActivityListResponseVo> responseVoList = activityService.deleteActivityInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "get_fish_pole_list", description = "获取鱼竿设置信息列表")
    @PostMapping("/get_fish_pole_list")
    @ResponseBody
    public ServerResponse<List<FishPoleVo>> getFishPoleList(@Validated @RequestBody FishPoleListRequestParam requestParam, HttpServletRequest request) {
        List<FishPoleVo> responseVoList = activityService.getFishPoleList(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "add_fish_pole", description = "添加鱼竿设置信息")
    @PostMapping("/add_fish_pole")
    @ResponseBody
    public ServerResponse<List<FishPoleVo>> addFishPole(@Validated @RequestBody FishPoleAddRequestParam requestParam, HttpServletRequest request) {
        List<FishPoleVo> responseVoList = activityService.addFishPole(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "edit_fish_pole", description = "修改鱼竿设置信息")
    @PostMapping("/edit_fish_pole")
    @ResponseBody
    public ServerResponse<List<FishPoleVo>> editFishPole(@Validated @RequestBody FishPoleEditRequestParam requestParam, HttpServletRequest request) {
        List<FishPoleVo> responseVoList = activityService.editFishPole(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "delete_fish_pole", description = "删除鱼竿设置信息")
    @PostMapping("/delete_fish_pole")
    @ResponseBody
    public ServerResponse<List<FishPoleVo>> deleteFishPole(@Validated @RequestBody FishPoleDeleteRequestParam requestParam, HttpServletRequest request) {
        List<FishPoleVo> responseVoList = activityService.deleteFishPole(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "get_award_list", description = "获取实物奖品列表")
    @PostMapping("/get_award_list")
    @ResponseBody
    public ServerResponse<List<AwardVo>> getAwardList(@Validated @RequestBody AwardListRequestParam requestParam, HttpServletRequest request) {
        List<AwardVo> responseVoList = activityService.getAwardList(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "add_award_info", description = "添加实物奖品")
    @PostMapping("/add_award_info")
    @ResponseBody
    public ServerResponse<List<AwardVo>> addAwardInfo(@Validated @RequestBody AwardAddRequestParam requestParam, HttpServletRequest request) {
        List<AwardVo> responseVoList = activityService.addAwardInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "edit_award_info", description = "修改实物奖品")
    @PostMapping("/edit_award_info")
    @ResponseBody
    public ServerResponse<List<AwardVo>> editAwardInfo(@Validated @RequestBody AwardEditRequestParam requestParam, HttpServletRequest request) {
        List<AwardVo> responseVoList = activityService.editAwardInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }

    @Operation(summary = "delete_award_info", description = "修改鱼竿设置列表")
    @PostMapping("/delete_award_info")
    @ResponseBody
    public ServerResponse<List<AwardVo>> deleteAwardInfo(@Validated @RequestBody AwardDeleteRequestParam requestParam, HttpServletRequest request) {
        List<AwardVo> responseVoList = activityService.deleteAwardInfo(requestParam);
        return new ServerResponse<>(responseVoList);
    }


    @Operation(summary = "get_activity_award_list", description = "获取实物奖品兑奖列表")
    @PostMapping("/get_activity_award_list")
    @ResponseBody
    public ServerResponse<List<ActivityAwardVo>> getActivityAwardList(@Validated @RequestBody ActivityAwardRequestParam requestParam, HttpServletRequest request) {
        List<ActivityAwardVo> responseVoList = activityService.getActivityAwardList(requestParam);
        return new ServerResponse<>(responseVoList);
    }

}
